<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path=request.getScheme()+"://"+request.getServerName()+":"+
	request.getServerPort()+request.getContextPath()+"/";
	pageContext.setAttribute("path", path);
	String imgPath=request.getScheme()+"://"+request.getServerName()+":"+
			request.getServerPort()+"/Hospital-pic/";
%>
<!DOCTYPE html>
<html>
 <head>
    <title>药品查询</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="${path }Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="${path }Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="${path }Css/style.css" />
    <script type="text/javascript" src="${path }Js/jquery.js"></script>
    <script type="text/javascript" src="${path }Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="${path }Js/bootstrap.js"></script>
    <script type="text/javascript" src="${path }Js/ckform.js"></script>
    <script type="text/javascript" src="${path }Js/common.js"></script>

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
    <script type="text/javascript">
	
    </script>
</head>
<body>
<table class="table table-bordered table-hover definewidth m10" >
   <thead>
    <tr>
        <th><input type="checkbox" id="checkall" onChange="checkall();"></th>
    	<th>药品编号</th>
        <th>药品名称</th>
        <th>药品类别</th>
        <th>售价</th>
        <th>生产日期</th>
        <th>过期日期</th>
        <th>库存（盒）</th>
        <th>生产商</th>
        <th>功效</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    	 <c:forEach items="${drug}" var="drug">
    	  <tr>
    	      <td><input type="checkbox"/></td>
	   	      <td>${drug.did }</td>
	   	      <td>${drug.dname}</td>
	   	      <td>${drug.dclass }</td>
	   	      <td>${drug.dprice}</td>
	   	      <td>${drug.prodate}</td>
	   	      <td>${drug.exdate}</td>
	   	      <td>${drug.requantity}</td>
	   	      <td>${drug.sname}</td>
	   	      <td>${drug.function}</td>
	   	      <td>
	   	      <a href="drugServlet.do?method=deleteDrugByDid&did=${drug.did}">删除</a>
	   	      <a href="drugServlet.do?method=updateDrugByDid&did=${drug.did}">更新</a>
	   	      </td>
    	 </tr>
    	 </c:forEach>
     </tbody>
  </table>
  
  <table class="table table-bordered table-hover definewidth m10" >
  	<tr><th colspan="5"> 
  			<div class="inline pull-right page">
	          <a href="${path}drugServlet.do?method=showDrugByPage&current_page=1" >首页</a> 
	          <a href="${path}drugServlet.do?method=showDrugByPage&current_page=${pt.pre_page}">上一页</a>     
	          <a href="${path}drugServlet.do?method=showDrugByPage&current_page=${pt.next_page}" >下一页</a> 
	          <a href="${path}drugServlet.do?method=showDrugByPage&current_page=${pt.count_page}" >尾页</a>
			  &nbsp;&nbsp;&nbsp;
			     共<span class='current'>${pt.count_rows }</span>条记录
			  <span class='current'> ${pt.current_page } </span>页
		  </div>
		 <div>
			<button type="button" class="btn btn-success" id="newNav">添加新药</button>	
			<button type="button" class="btn btn-success" onclick="delAll()">批量删除</button>		
		 </div>
		 
		 </th></tr>
  </table>
  
   <script>
        $("#newNav").click(function(){
            window.location.href="drug/add.jsp";
        });
   </script>
  
</body>
</html>
